#include "lottery.h"

//lotteryNode,lyNode申请空间
lyNode * mkLyNode()
{
    lyNode *node=(lyNode*)malloc(sizeof(lyNode));
    if(NULL == node)
    {
        printf("error...\n");
        tuichu;
    }
    memset(node,0,sizeof(lyNode));
    return node;
}

//lotteryList,lyList申请空间
lyList * mkLyList()
{
    lyList *list=(lyList*)malloc(sizeof(lyList));
    if(NULL == list)
    {
        printf("error...\n");
        tuichu;
    }
    memset(list,0,sizeof(lyList));
    return list;
}

//头插法生成彩票链表
void lotteryInsert(lyList *list,lyNode *node)
{
    if(NULL==list||NULL==node)
    {
        return;
    }
    node->pnext=list->pFirstNode;
    list->pFirstNode=node;
    list->LLen++;
}

//buyLotteryNode,buyLyNode申请空间
buyLyNode * mkBuyLyNode()
{
    buyLyNode *node=(buyLyNode*)malloc(sizeof(buyLyNode));
    if(NULL == node)
    {
        printf("error...\n");
        tuichu;
    }
    memset(node,0,sizeof(buyLyNode));
    return node;
}

//buyLotteryList,buyLyList申请空间
buyLyList * mkBuyLyList()
{
    buyLyList *list=(buyLyList*)malloc(sizeof(buyLyList));
    if(NULL == list)
    {
        printf("error...\n");
        tuichu;
    }
    memset(list,0,sizeof(buyLyList));
    return list;
}

//头插法生成彩民购买彩票链表
void buyLotteryInsert(buyLyList *list,buyLyNode *node)
{
    if(NULL==list||NULL==node)
    {
        return;
    }
    node->pnext=list->pFirstNode;
    list->pFirstNode=node;
    list->LLen++;
}
